package com.topscomm.gpm;

import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSON;
import com.topscomm.app.pojo.AppPageEntity;
import com.topscomm.app.service.IAppPageService;
import com.topscomm.app.service.IAppPageTabService;
import com.topscomm.cbo.pojo.CboApprovalNodeEntity;
import com.topscomm.cbo.pojo.CboApprovalNodeInsEntity;
import com.topscomm.cbo.service.ICboApprovalNodeInsService;
import com.topscomm.cbo.service.ICboAttachmentService;
import com.topscomm.cbo.service.impl.CboApprovalNodeService;
import com.topscomm.cbo.service.impl.CboAttachmentService;
import com.topscomm.mis.MisController;
import com.topscomm.mms.pojo.MmsDeptExtraInfoEntity;
import com.topscomm.mms.service.impl.MmsDeptExtraInfoService;
import com.topscomm.mms.service.impl.MmsProvinceCityMatchinfoService;
import com.topscomm.pub.util.*;
import com.topscomm.pub.vo.ResponseResult;
import com.topscomm.gpm.pojo.GpmProjectEntity;
import com.topscomm.gpm.pojo.GpmWfFormEntity;
import com.topscomm.gpm.service.impl.GpmProjectHistoryService;
import com.topscomm.gpm.service.impl.GpmProjectService;
import com.topscomm.gpm.service.impl.GpmWfFormService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.io.IOException;
import java.math.BigDecimal;
import java.sql.SQLException;
import java.text.NumberFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * @Description TODO
 * @Classname SdController
 * @Date 2021/11/19
 * @Created by jiangtao
 */
public class GpmController<T extends GpmEntity, TService extends IGpmService<T, ?>> extends MisController<T, TService>
		implements IGpmController<T, TService> {
	@Autowired
	private MmsDeptExtraInfoService mmsDeptExtraInfoService;
	@Autowired
	private MmsProvinceCityMatchinfoService mmsProvinceCityMatchinfoService;

    @Autowired
    protected ICboApprovalNodeInsService cboApprovalNodeInsService;
    @Autowired
	private IAppPageTabService appPageTabService;

	@Autowired
	private IAppPageService appPageService;
	@Autowired
	private GpmWfFormService gpmWfFormService;
	@Autowired
	private GpmProjectService gpmProjectService;
	@Autowired
	private GpmProjectHistoryService gpmProjectHistoryService;
	@Autowired
	private CboApprovalNodeService cboApprovalNodeService;


    @GetMapping("/checkIsApproval")
    public ResponseResult<Object> checkIsApproval(@RequestParam(required = false) Map<String, Object> paraMap) {
        StringBufferProxy sql = new StringBufferProxy();
        Map<String, Object> resultMap = new HashMap<>();
        resultMap.put("isapprover", false);
        // 待审批的节点信息
        sql.appendSingle(" SOURCEID = '{0}' AND SOURCETYPE = '{1}' AND STATE = '1' " +
                        "AND APPROVALUSERID = {2} ", paraMap.get("sourceid"), paraMap.get("sourcetype"),
                this.getUserBean().getUser().getId());
        List<CboApprovalNodeInsEntity> cboApprovalNodeInsEntities = cboApprovalNodeInsService
                .queryByWhere(sql.toString());
        if (cboApprovalNodeInsEntities.size() > 0) {
            resultMap.put("isapprover", true);
            resultMap.put("nodeinsid", cboApprovalNodeInsEntities.get(0).getId());
        }
        return ResponseResult.ok(resultMap);
    }
	/**
	 * @description: 部门拓展信息表权限查询拼接
	 * @param sql
	 * @param paraMap
	 * @return void
	 * @author: wangxinhua
	 * @date: 2021/12/15 11:22
	 * @modify:
	 */
	protected void MmsDeptExtraSearchSql(StringBufferProxy sql, Map<String, Object> paraMap) {

		List<MmsDeptExtraInfoEntity> extraInfoEntities = queryDeptExtraInfo(paraMap);
		if (extraInfoEntities.size() > 0) {
			String strDeptcommoncode = extraInfoEntities.stream().map(s -> "'" + s.getDeptcommoncode() + "'")
					.collect(Collectors.joining(", "));
			sql.appendSingle(" or deptcommoncode1 in (" + strDeptcommoncode + ")");
		}
	}

	/**
	 * @description: 获取当前人管理的一级部门
	 * @param paraMap
	 * @return java.util.List<com.topscomm.mms.pojo.MmsDeptExtraInfoEntity>
	 * @author: wangxinhua
	 * @date: 2021/12/15 11:22
	 * @modify:
	 */
	protected List<MmsDeptExtraInfoEntity> queryDeptExtraInfo(Map<String, Object> paraMap) {
		// 获取当前人所在一级部门编号
		StringBufferProxy deptExtraSql = new StringBufferProxy();
		deptExtraSql.appendSingle(" {1}=1 and ({2}='{0}' or {3}='{0}' or {4}='{0}')",
				this.getUserBean().getUser().getCode(), MmsDeptExtraInfoEntity.FieldEnabled,
				MmsDeptExtraInfoEntity.FieldProvincemanagercode, MmsDeptExtraInfoEntity.FieldCfocode,
				MmsDeptExtraInfoEntity.FieldProvincechocode);
		List<com.topscomm.mms.pojo.MmsDeptExtraInfoEntity> extraInfoEntities = mmsDeptExtraInfoService.queryByWhere(deptExtraSql.toString());
		return extraInfoEntities;
	}

	/**
	 * @description: 省区地市表权限查询拼接
	 * @param sql
	 * @param paraMap
	 * @return void
	 * @author: wangxinhua
	 * @date: 2021/7/29 16:38
	 * @modify:
	 */
	protected void MmsProvinceMatchSearchSql(StringBufferProxy sql, Map<String, Object> paraMap) {
		Map<String, Object> searchMap = new HashMap<String, Object>();
		searchMap.put("usercode", this.getUserBean().getUser().getCode());
		List<Map<String, Object>> matchInfos = mmsProvinceCityMatchinfoService.acquireAllLowerArea(searchMap);
		if (matchInfos.size() > 0) {
			String strCode = matchInfos.stream().filter(s -> !ObjectUtil.isEmpty(s.get("code"))).map(s -> "'" + s.get("code") + "'")
					.collect(Collectors.joining(", "));
			if (!StringUtil.isEmpty(strCode)) {
				sql.appendSingle(" or deptname2 in (" + strCode + ")" + " or deptname1 in (" + strCode + ")" + " or deptname3 in (" + strCode + ")");
			}
		}
	}

	/***
	 * @description: 添加额外的数据项
	 * @param paraMap
	 * @param mainListData
	 * @return
	 * @author: jiangtao1
	 * @date: 2021/12/20 9:42
	 * @modify:
	 */
	public void mainListExtraData(Map<String, Object> paraMap, Map<String, Object> mainListData) {
	}


	/***
	 * @description: 手机端专用接口
	 * @param paraMap
	 * @return
	 * @author: jiangtao1
	 * @date: 2021/12/20 9:42
	 * @modify:
	 */
	@GetMapping(value = "/loadMobilePageInfo")
	public ResponseResult<Object> loadMobilePageInfo(@RequestParam(required = false) Map<String, Object> paraMap) throws SQLException, IOException {
		paraMap = BaseUtil.decodeSecureMap(paraMap);
		String pageCode = this.service.getDao().getTableName();
		Map<String, Object> myDadaMap = new HashMap<>();
		//查询页面配置的sql语句
		StringBufferProxy sqlForAppPage = new StringBufferProxy();
		StringBufferProxy sqlForAppPageTab = new StringBufferProxy();
		sqlForAppPage.appendSingle("code='{0}' and enabled=1", pageCode);
		//获取页面信息
		AppPageEntity page = appPageService.queryObjectByWhere(sqlForAppPage.toString());
		//获取tab信息
		sqlForAppPageTab.appendSingle("pageid='{0}' and enabled=1", page.getId());
		List<Map<String, Object>> appPageTabList = appPageTabService.queryMapByWhere(sqlForAppPageTab.toString());
		//获取主Tab(list中只有一个mainTab)
		List<Map<String, Object>> listMain = appPageTabList.stream().filter(b -> "mainList".equals(ConvertUtil.convertToString(b.get("code")))).collect(Collectors.toList());
		//获取节点信息
		Map<String, Object> mainListData1;
		if("GpmProject".equals(pageCode)) {
			GpmWfFormEntity gpmWfFormEntity = gpmWfFormService.queryById(paraMap.get("id").toString());
			mainListData1 = gpmProjectService.queryMapById(ConvertUtil.convertToString(gpmWfFormEntity.getSourceid()));
			mainListData1.put("flowid", gpmWfFormEntity.getFlowid());
		} else if("GpmProjectHistory".equals(pageCode)) {
			GpmWfFormEntity gpmWfFormEntity = gpmWfFormService.queryById(paraMap.get("id").toString());
			mainListData1 = gpmProjectHistoryService.queryMapById(ConvertUtil.convertToString(gpmWfFormEntity.getSourceid()));
			mainListData1.put("flowid", gpmWfFormEntity.getFlowid());
		} else {
			mainListData1 = this.service.queryMapById(paraMap.get("id").toString());//主表信息
		}
		CboApprovalNodeInsEntity queryById = cboApprovalNodeInsService.queryObjectByWhere("flowid = '" + mainListData1.get("flowid").toString() + "'");
		Map<String, Object> mainTab = listMain.get(0);
		//如果此页面有一个tab则只需要处理主表数据
		if (appPageTabList.size() <= 1) {
			//取数据
			Map<String, Object> mainListData = mainListData1;
			//将取出的详细数据放入
			List<Map<String, Object>> mainList = new ArrayList<>();
			mainList.add(mainListData);
			// 其他主表数据
			mainListExtraData(paraMap, mainListData);
			//塞入数据（数据的key约定为“表名+‘List’”）
			myDadaMap.put("mainList", mainList);
			//获取页面（约定：app管理页面配置中的页面编码对应controller表名）
			appPageService.getPageInfo(this.service.getDao().getTableName(), myDadaMap);
			return ResponseResult.ok(myDadaMap);
		} else {
			//处理多tab逻辑（约定：1.mainList为单据信息 2.其他Tab信息：扩展1字段：查询此tab的controller 2.扩展2字段：主tab中的字段 3.扩展3字段：此tab中的字段）
			//主表数据
			Map<String, Object> mainListData = mainListData1;
			mainListExtraData(paraMap, mainListData);

			//将取出的详细数据放入
			List<Map<String, Object>> mainList = new ArrayList<>();
			mainList.add(mainListData);
			//塞入主表数据数据（数据的key约定为“表名+‘List’”）
			myDadaMap.put("mainList", mainList);
			//查询其他tab数据
			for (Map<String, Object> tabItem : appPageTabList) {
				if (!"mainList".equals(ConvertUtil.convertToString(tabItem.get("code")))) {
					// 子表action
					GpmController basicSubAction = (GpmController) SpringUtil.getBean(ConvertUtil.convertToString(tabItem.get("extendfield1")));
					//查询子表数据的sql语句
					StringBufferProxy sqlForSub = new StringBufferProxy();
					//主tab字段名称
					String mainTabFieldStr = ConvertUtil.convertToString(tabItem.get("extendfield2"));
					//此tab字段名称
					String subTabFieldStr = ConvertUtil.convertToString(tabItem.get("extendfield3"));
					// app模板页面id
					String tabTemplateId = ConvertUtil.convertToString(tabItem.get("extendfield4"));

					//拼装此tab需要的sql
					sqlForSub.appendSingle("{0} = '{1}'", subTabFieldStr, ConvertUtil.convertToString(mainListData.get(mainTabFieldStr)));
					//查询子表数据
					List<Map<String, Object>> subList = basicSubAction.service.queryMapByWhere(sqlForSub.toString());
					//将取出的详细数据放入
					myDadaMap.put(ConvertUtil.convertToString(tabItem.get("relationdata")), subList);
				}
			}
			// 当前节点不为空时添加附件信息
			if (queryById != null) {
				ICboAttachmentService cboAttachmentService = (CboAttachmentService) SpringUtil.getBean("cboAttachmentService");
				List<String> fieldList = new ArrayList<>();
				fieldList.add("filetype");
				fieldList.add("filesize");
				fieldList.add("displayname");
				fieldList.add("sourcetype");
				fieldList.add("id");
				List<Map<String, Object>> attachList = new ArrayList<>();
				// 如果是项目合同信息则只需要根据sourceid查询即可（合同流程中有多个附件）
				if (this.service.getDao().getTableName().equals("PmContract")) {
					StringBufferProxy whereSqlForAttachList = new StringBufferProxy();
					whereSqlForAttachList.appendSingle("sourceid = '{0}' and sourcetype in ('PmContract','PmSignContract') ", ConvertUtil.convertToString(paraMap.get("id")));
					attachList = cboAttachmentService.queryMapFieldsByWhere(whereSqlForAttachList.toString(), fieldList);
				} else {
					attachList = cboAttachmentService.queryMapFieldsByWhere("sourceid=" + ConvertUtil.convertToString(paraMap.get("id")) + " and sourcetype='" + queryById.getSourcetype() + "'", fieldList);

				}
				myDadaMap.put("attachmentList", attachList);
			}
			appPageService.getPageInfo(pageCode, myDadaMap);
			return ResponseResult.ok(myDadaMap);
		}
	}
	/***
	 * @description: 手机端使用接口
	 * @param paraMap
	 * @return
	 * @author: houyuhang
	 * @date: 2021/12/28
	 * @modify:
	 */
	@GetMapping(value = "/loadMobileTotalPageInfo")
	public ResponseResult<Object> loadMobileTotalPageInfo(@RequestParam(required = false) Map<String, Object> paraMap) throws SQLException, IOException {
		paraMap = BaseUtil.decodeSecureMap(paraMap);
		// 如果projectcode的值为null,则为消息跳转，需要根据id转到项目具体的projectcode
		if (ObjectUtil.isEmpty(paraMap.get("code"))) {
			GpmProjectEntity gpmProjectEntity = gpmProjectService.queryById(ConvertUtil.convertToString(paraMap.get("id")));
			if (ObjectUtil.isEmpty(gpmProjectEntity)) {
				return ResponseResult.error("获取信息失败,项目不存在");
			}
			paraMap.put("code", gpmProjectEntity.getProjectcode());
		}
		// 先获取所有的业务单据
		List<Map<String, Object>> pageList = datacodeCache.getCodeListMap("GpmMobileTotalPage", "", "sortcode");
		if (pageList == null || pageList.size() == 0) {
			return ResponseResult.error("获取信息失败");
		}
		Map<String, Object> dataMap = new HashMap<>();
		List<Map> tabs = new ArrayList<>();
		for (Map pageMap : pageList) {
			Map<String, String> tab = new HashMap<>();
			tab.put("title", pageMap.get("name").toString());
			tab.put("key", pageMap.get("code").toString());
			String pageCode = pageMap.get("code").toString();
			Map<String, Object> myDadaMap = new HashMap<>();
			//查询页面配置的sql语句
			StringBufferProxy sqlForAppPage = new StringBufferProxy();
			StringBufferProxy sqlForAppPageTab = new StringBufferProxy();
			sqlForAppPage.appendSingle("code='{0}' and enabled=1", pageCode);
			//获取页面信息
			AppPageEntity page = appPageService.queryObjectByWhere(sqlForAppPage.toString());
			//获取tab信息
			sqlForAppPageTab.appendSingle("pageid='{0}' and enabled=1", page.getId());
			List<Map<String, Object>> appPageTabList = appPageTabService.queryMapByWhere(sqlForAppPageTab.toString());
			//获取主Tab(list中只有一个mainTab)
			List<Map<String, Object>> listMain = appPageTabList.stream().filter(b -> "mainList".equals(ConvertUtil.convertToString(b.get("code")))).collect(Collectors.toList());
			GpmController mainAction = (GpmController) SpringUtil.getBean(toLowerCaseFirstOne(ConvertUtil.convertToString(pageMap.get("code"))) + "Controller");
			Map<String, Object> mainTab = listMain.get(0);
			Map<String, Object> mainListData = null;
			if (pageCode.equals("GpmProject")) {
				mainListData = mainAction.service.queryMapById(paraMap.get("id").toString());
			} else if (pageCode.equals("GpmProjectAppointment") || pageCode.equals("GpmProjectPlan") || pageCode.equals("GpmProjectReview")) {
				if (paraMap.containsKey("code") && paraMap.get("code").toString().length() > 0) {
					List<Map<String, Object>> mainListDatas = mainAction.service.queryMapByWhere(" projectcode = '" + paraMap.get("code").toString() + "' order by id desc");
					if (mainListDatas != null && mainListDatas.size() > 0) {
						mainListData = mainListDatas.get(0);
					}
				}
			} else {
				if (paraMap.containsKey("code") && paraMap.get("code").toString().length() > 0) {
					List<Map<String, Object>> mainListDatas = mainAction.service.queryMapByWhere(" projectcode = '" + paraMap.get("code").toString() + "' order by id desc");
					if (mainListDatas != null && mainListDatas.size() > 0) {
						myDadaMap.put("mainList", mainListDatas);
						//查询其他tab数据
						bindTabData(appPageTabList, myDadaMap, mainListDatas.get(0));
						appPageService.getPageInfo(pageCode, myDadaMap);
						tabs.add(tab);
						dataMap.put(pageMap.get("code").toString(), myDadaMap);
					}
				}
			}
			if (mainListData != null) {
				// 添加额外的数据项
				mainListData =  mainListExtraDataForTotal(paraMap, mainListData,pageCode);
//                bindAttachment(paraMap,mainListData,pageCode);
				//将取出的详细数据放入
				List<Map<String, Object>> mainList = new ArrayList<>();
				mainList.add(mainListData);
				//塞入主表数据数据（数据的key约定为“表名+‘List’”）
				myDadaMap.put("mainList", mainList);
				//查询其他tab数据
				bindTabData(appPageTabList, myDadaMap, mainListData);
				appPageService.getPageInfo(pageCode, myDadaMap);
				tabs.add(tab);
				dataMap.put(pageMap.get("code").toString(), myDadaMap);
			}
		}
		dataMap.put("tabs", tabs);
		return ResponseResult.ok(dataMap);
	}
	//首字母转小写
	public static String toLowerCaseFirstOne(String s) {
		if (Character.isLowerCase(s.charAt(0)))
			return s;
		else
			return Character.toLowerCase(s.charAt(0)) + s.substring(1);
	}
	// 其他页签绑定数据
	public void bindTabData(List<Map<String, Object>> appPageTabList, Map<String, Object> myDadaMap, Map<String, Object> mainListData) {
		for (Map<String, Object> tabItem : appPageTabList) {
			if (!"mainList".equals(ConvertUtil.convertToString(tabItem.get("code")))) {
				// 子表action
				GpmController basicSubAction = (GpmController) SpringUtil.getBean(ConvertUtil.convertToString(tabItem.get("extendfield1")));
				//查询子表数据的sql语句
				StringBufferProxy sqlForSub = new StringBufferProxy();
				//主tab字段名称
				String mainTabFieldStr = ConvertUtil.convertToString(tabItem.get("extendfield2"));
				//此tab字段名称
				String subTabFieldStr = ConvertUtil.convertToString(tabItem.get("extendfield3"));
				// app模板页面id
				String tabTemplateId = ConvertUtil.convertToString(tabItem.get("extendfield4"));
				//拼装此tab需要的sql
				sqlForSub.appendSingle("{0} = '{1}'", subTabFieldStr, ConvertUtil.convertToString(mainListData.get(mainTabFieldStr)));
				//查询子表数据
				List<Map<String, Object>> subList = basicSubAction.service.queryMapByWhere(sqlForSub.toString());
				//将取出的详细数据放入
				myDadaMap.put(ConvertUtil.convertToString(tabItem.get("relationdata")), subList);
			}
		}
	}
	/**
	 * 添加额外的数据项
	 *
	 * @param paraMap
	 * @param mainListData
	 */
	public Map<String,Object> mainListExtraDataForTotal(Map<String, Object> paraMap, Map<String, Object> mainListData, String pageCode) {
		if (pageCode.equals("MpmProject")) {
			GpmController mainAction = (GpmController) SpringUtil.getBean(toLowerCaseFirstOne(pageCode + "Controller"));
			Map<String, Object> dataMapsale = mainAction.service.queryMapById(paraMap.get("id").toString());
			if (!dataMapsale.isEmpty()) {
				//涉及产品范围
				String productInfo = ConvertUtil.convertToString(mainListData.get("productrange"));
				List<Map> maps = (List<Map>) JSON.parse(productInfo);
				StringBufferProxy productInfoPorxy = new StringBufferProxy();
				if (maps != null) {
					for (Map map : maps) {
						//产品名称
						String product = ConvertUtil.convertToString(map.get("productType"));
						//产品金额
						String money = ConvertUtil.convertToString(map.get("productMoney"));
						if (money.length() > 0) {
							//金额格式化 追加万元
							money = formatMonty(money, 9, 2);
						}
						productInfoPorxy.appendLineSingle(product + "-" + money);
					}
				}
				dataMapsale.put("productrange", productInfoPorxy.toString());
				mainListData.putAll(dataMapsale);
			}
		}
		return  mainListData;
	}
	/**
	 * @author: houyuhang
	 * @date: 2021-12-28
	 * @param: value
	 * @param: maxDigit
	 * @param: minDigit
	 * @description:格式化金额
	 * @return: java.lang.String
	 * @modify:
	 */
	protected String formatMonty(String value, int maxDigit, int minDigit) {
		if (value != null && !value.equals("")) {
			try {
				BigDecimal bigDecimal = new BigDecimal(value);
				NumberFormat currency = NumberFormat.getNumberInstance();
				currency.setMaximumFractionDigits(maxDigit);
				currency.setMinimumFractionDigits(minDigit);
				String s = currency.format(bigDecimal.doubleValue());
				value = s + "万元";
				return value;
			} catch (Exception var7) {
				return value;
			}
		} else {
			return "";
		}
	}
	@GetMapping("/queryDeptCommonCode")
	public ResponseResult<Object> queryDeptCommonCode(@RequestParam(required = false) Map<String, Object> paraMap) {
		String deptcode = ConvertUtil.convertToString(paraMap.get("deptcode"));
		String deptcommoncode1 = mmsDeptExtraInfoService.getDeptCommonCode(deptcode);
		Map<String, Object> resultMap = new HashMap<>();
		resultMap.put("deptcommoncode1",deptcommoncode1);
		return ResponseResult.ok(resultMap);
	}
	/**
	 * 手机端查询审批节点历史
	 *
	 * @author: houyuhang
	 * @date: 2021年12月28日下午1:39:58
	 * @params:
	 * @return_type: ResponseResult<Object>
	 * @description:
	 * @modify:
	 */
	@GetMapping(value = "/listHistoryRecord")
	public ResponseResult<Object> listHistoryRecord(@RequestParam(required = false) Map<String, Object> paraMap) {
		Map result = new HashMap<>();
		String sord = ConvertUtil.convertToString(paraMap.get("sord"));
		// 如果sourcetype为SdProject,即为消息跳转提供的sourcetype，需要转换为SdWfForm
		String sourceTypeOrigin = ConvertUtil.convertToString(paraMap.get("sourceType"));
		String sourceType = "GpmProject".equals(sourceTypeOrigin) ? "GpmWfForm" : sourceTypeOrigin;
		StringBufferProxy sql = new StringBufferProxy();
		List<Map<String, Object>> listDataMap = new ArrayList<Map<String, Object>>();
		sql.appendSingle(" sourceid = {0} ", paraMap.get("sourceId"));
		sql.appendSingle(" and sourcetype = '{0}' ", sourceType);
		List<Map<String, Object>> listFlow = cboApprovalNodeInsService.queryMapForPage(sql.toString(), 1, 100, "createon desc,id", sord);
		if (listFlow != null && listFlow.size() > 0) {
			listDataMap = listFlow;
			for (Map mapRow : listDataMap) {
				System.out.println(mapRow.get("nodeid"));
				CboApprovalNodeEntity node = cboApprovalNodeService.queryById(ConvertUtil.convertToString(mapRow.get("nodeid")));
				if (node != null) {
					int nodetype = node.getNodetype();
					mapRow.put("nodetype", nodetype);
					String nodetypename = "";
					if(nodetype == 2 || nodetype == 3 || nodetype == 4) {
						nodetypename = datacodeCache.getValueDynamic("TapApprovalNodeType", nodetype+"", "code", "name");
						if(nodetypename.lastIndexOf("节点")>1) {
							nodetypename = nodetypename.substring(0,nodetypename.lastIndexOf("节点"));
						}
					}
					mapRow.put("dispnodetype", nodetypename);
				}
			}
		} else {
			return ResponseResult.ok("没有查询到相关审批历史！");
		}
		result.put("dataList", listDataMap);
		return ResponseResult.ok(result);
	}
}
